<?php
/**
 * @copyright meila.com
 * @author shaopu@
 * @name 
 * @param 
 *         $xxx = 作用
 * @static 
 *         XXX = 作用
 * 
 * 
 */
$dir = dirname(dirname(__FILE__));
include($dir.'/__queue_global.php');

class ml_mq_registerCheck extends MqClass{
    const QUEUE_NAME = ML_QUEUENAME_REGI_CHECK;
    private $oExt;
    private $oBrief;
    private $oClt;
    
    public function __construct($queue)
    {
        $this->oExt = new ml_model_dbUserExtInfo();
        $this->oBrief = new ml_model_dbUserBriefInfo();
        
        $this->oClt = new ml_model_dbCollectionBox();
        
        
        parent::__construct($queue);
    }
    /**
     * 发邮件
     *
     * @param array $message_data
     * array(
     *        to => xxx@xxx.com
     *        type => register
     *        data => array()
     * )
     */
    public function run_job( ){
        $uid = $this->src_data['uid'];
        
        
        $this->oExt->createRecord($uid);
        $this->oBrief->createRecord($uid);
        /**
         * @todo 容错
         */
        $n = $this->oClt->yz_full($uid);
        
        if($n['num'] < 1)
        {
            $aNewuser = ml_factory::load_standard_conf('newuser');
            foreach ($aNewuser['collection'] as $box_name)
            {
                $this->oClt->createCollection($uid , $box_name , '');
            }
        }
        
        return true;
    }

}

ml_run_queue_check(ml_mq_registerCheck::QUEUE_NAME);


$mcq = new McQueue(ml_mq_registerCheck::QUEUE_NAME);
$xblog_obj = new ml_mq_registerCheck($mcq);
$argv[1]   = __FILE__;
$xblog_obj->setArgv($argv[1]);
$xblog_obj->execute();
?>